package com.candy.excep;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @author donglin
 * @Title:抛出异常
 * @类名: Test02
 * @date 2020/5/22
 */
public class Test02 {
    public static void main(String[] args) {
        try {
            test03();
        }catch (Exception e){
            System.out.println(e);
        }
    }
    public static void test03(){
       int a=0;
       if(a==0){
           //手动制造异常进行抛出
           throw new NullPointerException("这里是手动进行制造的异常");
       }

    }

    public static void test02(){
        //对抛出的异常进行异常处理
        try {
            test01();
        } catch (FileNotFoundException e) {
            System.out.println(e);
        }

    }
    //抛出异常
    public static void test01() throws FileNotFoundException {
        FileInputStream f1=new FileInputStream("");

    }

}
